# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ttyd
pkgver=1.7.4
pkgrel=0
pkgdesc="Share your terminal over the web"
url="https://tsl0922.github.io/ttyd"
arch="all"
license="MIT"
depends="libwebsockets-evlib_uv"
makedepends="
	bsd-compat-headers
	cmake
	json-c-dev
	libuv-dev
	libwebsockets-dev
	openssl-dev>3
	samurai
	zlib-dev
	"
subpackages="$pkgname-doc"
source="https://github.com/tsl0922/ttyd/archive/$pkgver/ttyd-$pkgver.tar.gz"

build() {
	local crossopts=
	if [ "$CBUILD" != "$CHOST" ]; then
		crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=TRUE \
		$crossopts
	cmake --build build
}

check() {
	./build/ttyd --version
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
bbaa56389c224db9438b6dcce696deb0eeedfdf9b3a68cbc4c01c155340f71558e1d90c3fabe9a52de180728792b8dc7deed0c3512acdc246d651270d7fb82c6  ttyd-1.7.4.tar.gz
"
